package com.qjl.shopping.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseEntity {
	private int status;
	private String info;
	private Object data;
	private Map<String, Object> map = new HashMap<>();

	public ResponseEntity(int status, String info, Object data) {
		super();
		this.status = status;
		this.info = info;
		this.data = data;
	}
	
	public ResponseEntity(int status, String info) {
		super();
		this.status = status;
		this.info = info;
	}
	
	public ResponseEntity(int status) {
		super();
		this.status = status;
	}

	public ResponseEntity(Object data) {
		super();
		this.data = data;
	}

	public static ResponseEntity success(String info){
		return new ResponseEntity(Constants.CODE_200, info);
	}

	public static ResponseEntity success(String info,Object data){
		return new ResponseEntity(Constants.CODE_200, info, data);
	}

	public static ResponseEntity success(String info,Map<String, Object> data){
		return new ResponseEntity(Constants.CODE_200, info, data);
	}

	public static ResponseEntity error(String info){
		return new ResponseEntity(Constants.CODE_400, info);
	}

	public static ResponseEntity error(int status, String info){
		return new ResponseEntity(status, info);
	}

	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public String getInfo() {
		return info;
	}
	public void setInfo(String info) {
		this.info = info;
	}
	public Object getData() {
		return data;
	}
	public void setData(Object data) {
		this.data = data;
	}
	public Map<String, Object> getMap() {
		return map;
	}
	public void setMap(Map<String, Object> map) {
		this.map = map;
	}
	
}
